package com.mynews.utils;

import android.text.TextUtils;

import java.text.SimpleDateFormat;

/**
 * Created by Administrator on 2017/6/27.
 */

public class StringUtils {

    /**
     *  20170602 ---> 2017年06月02日
     * @param s
     * @return
     */
    public static String toDate(String s){
        StringBuffer  date = new StringBuffer();
        if(TextUtils.isEmpty(s))return date.toString();
        String year = s.substring(0, 4);
        String month = s.substring(4, 6);
        String day = s.substring(6, 8);
        date.append(year).append("年").append(month).append("月").append(day).append("日");
        return date.toString();
    }

    public static String currentDate(){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long l = System.currentTimeMillis();
        return simpleDateFormat.format(l);
    }
}
